home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / TestParts / Clock / ClockGbl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-01  |  5.9 KB  |  180 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ClockGbl.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Richard Rodseth
  7.  
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.         <11>    10/23/95    RR        #1291688 Added test for adding New menus
  13.         <10>    10/13/95    EL        1287340: Use standard ISO prefix
  14.          <9>     9/12/95    RR        Various activation problems. Added a
  15.                                     floating window
  16.          <8>      9/4/95    TJ        Added Includes to Compile with out
  17.                                     PC-Headers.
  18.          <7>      9/1/95    RR        # 1244639 Added fDisplaySettingsDialog &
  19.                                     RemovingFrame()
  20.          <6>     7/10/95    RR        Misc. cleanup and bug fixes for shared
  21.                                     window
  22.          <5>      7/7/95    RR        Some refactoring. Fix
  23.                                     CreatePropObjSpecifier to deal with
  24.                                     non-persistent frame. Set source frame of
  25.                                     dialogs.
  26.          <4>     6/30/95    RR        1242642 BB Ref counting fixes. Display
  27.                                     settings window is saved as an ID, not a
  28.                                     window
  29.          <3>      6/3/95    TJ        Added #includes for compile with out PCH
  30.          <2>      6/1/95    RR        Removed "static"
  31.          <1>     5/31/95    RR        first checked in
  32.  
  33.     To Do:
  34. */
  35.  
  36. #ifndef _CLOCKGBL_
  37. #define _CLOCKGBL_
  38.  
  39. #ifndef SOM_ODSession_xh
  40. #include <ODSessn.xh>
  41. #endif
  42.  
  43. #ifndef __DIALOGS__
  44. #include "Dialogs.h"
  45. #endif
  46.  
  47. #ifndef SOM_ODMenuBar_xh
  48. #include <MenuBar.xh>
  49. #endif
  50.  
  51. #ifndef SOM_ODWindowState_xh
  52. #include <WinStat.xh>
  53. #endif
  54.  
  55. #ifndef _ODTYPES_
  56. #include <ODTypes.h>
  57. #endif
  58.  
  59. //=========================================================================
  60. // Classes Defined Here
  61. //=========================================================================
  62.  
  63. class ClockGlobals;
  64.  
  65. //=========================================================================
  66. // Classes Used Here
  67. //=========================================================================
  68.  
  69. class OrderedCollection;
  70.  
  71. //=========================================================================
  72. // Global Data
  73. //=========================================================================
  74.  
  75. extern ClockGlobals* gClockGlobals;
  76.  
  77. //=========================================================================
  78. // Function Prototypes
  79. //=========================================================================
  80.  
  81. pascal Boolean ClockDialogFilter(DialogPtr dialog,
  82.                               EventRecord* event,
  83.                               short* itemHit);
  84. pascal Boolean AboutDialogFilter(DialogPtr dialog,
  85.                               EventRecord* event,
  86.                               short* itemHit);
  87.  
  88. //=========================================================================
  89. // Constants
  90. //=========================================================================
  91.  
  92. #define kCPIdleFrequency                20
  93.  
  94. const    ODPropertyName    kPropClockType   = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Property:Type";
  95. const    ODPropertyName    kPropClockFont   = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Property:Font";
  96. const    ODPropertyName    kPropClockStyle  = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Property:Style";
  97. const    ODPropertyName    kPropClockSize   = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Property:Size";
  98.  
  99. // To identify different frames 
  100.  
  101. const ODType kClockFrame   = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Presentation:Time";
  102. const ODType kSynchronizeFrame  = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Presentation:Synchronize";
  103. const ODType kAlarmSettingsFrame   = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Presentation:AlarmSettings";
  104. const ODType kDisplaySettingsFrame   = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Presentation:DisplaySettings";
  105. const ODType kDialogFrame   = "+//ISO 9070/ANSI::113722::US::CI LABS::Apple:TestClock:Presentation:Dialog";
  106.  
  107. // Command IDs
  108.  
  109. const ODCommandID cSynchronize = 20001;
  110. const ODCommandID cShowAlarmSettings = 20002;
  111. const ODCommandID cShowDisplaySettings = 20003;
  112. const ODCommandID cAnalog = 20004;
  113. const ODCommandID cDigital = 20005;
  114. const ODCommandID cNewView = 20006;
  115. const ODCommandID cNewFloater = 20007;
  116. const ODCommandID cNewSinker = 20008;
  117. const ODCommandID cNewMenu = 20009;
  118. const ODCommandID cDeleteMenu = 20010;
  119.  
  120.  
  121. // private error codes:
  122.  
  123. const ODError  kODErrCannotAcquireWindow        = 71;
  124.  
  125. //=========================================================================
  126. // Function Prototypes
  127. //=========================================================================
  128.                               
  129. void CheckMarkMenu(MenuHandle menu, Str255 checkItem, ODBoolean checkIt);
  130. void StyleToString(ODUByte    style, Str255*    styleName );
  131.  
  132. //=========================================================================
  133. // Clock Globals
  134. //=========================================================================
  135.  
  136. class ClockGlobals
  137. {
  138. public:
  139.     ClockGlobals();
  140.     ~ClockGlobals();
  141.     void InitClockGlobals(Environment* ev, ODSession* session, ODPart* part);
  142.     void AcquireGlobals(Environment* ev);
  143.     void ReleaseGlobals(Environment* ev);
  144.     void FreeGlobals(Environment* ev);
  145.  
  146.     ODSession* GetSession(Environment* ev);
  147.     void CreateDisplaySettingsDialog(Environment* ev, ODFrame* sourceFrame);
  148.     void OpenDisplaySettingsDialog(Environment* ev,  ODFrame* sourceFrame);
  149.     void CloseDisplaySettingsWindow(Environment* ev);
  150.     void CreateAlarmSettingsDialog(Environment* ev, ODFrame* sourceFrame);
  151.     void OpenAlarmSettingsDialog(Environment* ev,  ODFrame* sourceFrame);
  152.     void CloseAlarmSettingsWindow(Environment* ev);
  153.  
  154.  
  155.  
  156.     void AcquiringFocus(Environment* ev, ODFrame* toFrame);
  157.     void SuspendWindows(Environment* ev, ODBoolean processChange);
  158.     void ResumeWindows(Environment* ev, ODBoolean processChange);
  159.     void RemovingFrame(Environment* ev, ODFrame* frame);
  160.  
  161.     void AddDialogFrame(Environment* ev, ODFrame* frame);
  162.     void RemoveDialogFrame(Environment* ev, ODFrame* frame);
  163.     void AdjustDialogs(Environment* ev);
  164.         
  165.     short fRefCount;
  166.     ODSession* fSession;
  167.     ODMenuBar* fMenuBar;
  168.     
  169.     ODID         fDisplaySettingsWindow;
  170.     DialogPtr   fDispaySettingsDialog;
  171.     ODID         fAlarmSettingsWindow;
  172.     DialogPtr   fAlarmSettingsDialog;
  173.     ODTypeToken fFrameView;                
  174.     ODTypeToken fDisplaySettingsPresentation;    
  175.     ODTypeToken fAlarmSettingsPresentation;    
  176.     OrderedCollection*    fDialogFrames;
  177. };
  178.  
  179. #endif // _CLOCKGBL_
  180.